<template>
  <div class="workbg">
    <n-h3>审核攻略管理员</n-h3>
    <n-scrollbar x-scrollable>
      <div style="width: 1000px">
        <n-space>
          <span :style="set.form_span">坎圈名字</span>
          <span :style="set.form_span">QQ号</span>
          <span :style="set.form_span">uid</span>
          <span :style="set.form_span">用户名</span>
          <span :style="set.form_span">操作</span>
        </n-space>
        <n-hr />
        <n-form
          ref="formRef"
          label-placement="left"
          label-width="auto"
          require-mark-placement="right-hanging"
        >
          <template v-for="item in nd.list">

            <n-form-item > 
              <n-space align="center">
                  <span :style="set.form_span">{{ item.name }}</span>
                  <span :style="set.form_span">{{ item.qq }}</span>
                  <span :style="set.form_span">{{ item.uid }}</span>
                  <span :style="set.form_span">{{ item.username }}</span>
                  <span :style="set.form_span">
                    <n-space>
                      <n-button size="small" @click="nd.suss(item._id?.['$oid'])">允许</n-button>
                      <n-button size="small" @click="nd.pass(item._id?.['$oid'])">拒绝</n-button>
                    </n-space>
                  </span>
                </n-space>
            </n-form-item>
            <n-hr style="margin-top: -7px" />
          </template>
        </n-form>
      </div>
    </n-scrollbar>
  </div>
</template>

<script>
//2024/05/02 猫燐
//审核攻略组组件内部
import axios from "axios";
import { cfg } from "@/cfg/cfg.js";

export default {
  mounted() {
    this.ct.get_user();
  },
  props: {
    val: { required: true },
    ct: { required: true },
  },
  setup(props) {
    const set = {
      form_span: "width:160px;text-align: center;display: inline-block;",
      form_input: "width:160px;",
    };

    let nd = reactive({
        list : [],
        suss : (id) => {
          alert(id);
        },
        pass : (id) => {
          alert(id);
        },
    });

    props.ct.get_user = () => {
      axios
        .get(`${cfg.url}`, {
          params: {
            t: "get/Introduction/get_review_user",
            authkey: cfg.user.authkey,
          },
        })
        .then((res) => {
          const data = res.data;
          nd.list = data.data;
        })
        .catch((err) => {
          alert(err);
        });
    };

    return {
      set,nd
    };
  },
};
</script>
